def is_prime(n):
    if n<2:
        return False
    if n==2:
        return True
    if n%2==0:
        return False
    for i in range(3, int(n**0.5) + 1, 2):
        if n%i==0:
            return False
    return True

def is_palindrome(m):
    s=str(m)
    return s==s[::-1]

print("2-1000内的所有回文素数有：")
for i in range(2,1001):
    res1 = is_prime(i)
    if res1:
        res2=is_palindrome(i)
        if res2:
            print(f"{i}")